package org.dreamwork.assistant.tools.cli.fx;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;

import java.net.URL;

public class MainApp extends Application {
    @Override
    public void start (Stage stage) throws Exception {
        URL url = getClass ().getClassLoader ().getResource ("jfx/distributor.fxml");
        FXMLLoader loader = new FXMLLoader (url);
        loader.load ();
        Parent root = loader.getRoot ();
        MainController controller = loader.getController ();

        URL icon = getClass ().getClassLoader().getResource ("delivery.png");
        if (icon != null)
            stage.getIcons ().add (new Image (icon.openStream ()));

        stage.setTitle ("Java Application Distributor -- v 0.9.0");
        Scene scene = new Scene (root);
        stage.setScene (scene);
        stage.show ();
        controller.setStage (stage);
    }
}
